package pref.junx.flybird.fragment.daily.Group;

import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.view.MenuItem;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import pref.junx.flybird.R;
import pref.junx.flybird.adapter.SimpleAdapter_gro;
import pref.junx.flybird.base.BaseFragment;
import pref.junx.flybird.entity.Group;
import pref.junx.flybird.entity.User_idea;


/**
 * Created by acer on 2017/8/4.
 */

public class GroupFragment extends BaseFragment<GroupPresenter, GroupModlel> implements GroupContract.View, PopupMenu.OnMenuItemClickListener {
    List<Group> groupList=new ArrayList<>();
    RecyclerView recyclerView;
    private List data = new ArrayList<User_idea>();
    private DefaultItemAnimator animator;
    private SimpleAdapter_gro adapter;
    @Override
    public int getLayoutId() {
        return R.layout.fragment_gro;
    }

    @Override
    public void initView() {

    }


    @Override
    protected void init() {
      presenter.getGroup(spTools.getInt("user_id"));
    }



    @Override
    public void reportsuccess(String a, int b) {


    }

    @Override
    public void reportfail(String a) {
        ts.show_l("上报失败");
    }

    @Override
    public void itmeSelect(String i, String n) {

    }

    @Override
    public void setGroup(List<Group> data) {
        groupList=data;
        recyclerView=(RecyclerView)getActivity().findViewById(R.id.recyclerview_gro);
        recyclerView.setHasFixedSize(true);
        recyclerView.setItemAnimator(animator);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        adapter = new SimpleAdapter_gro(getActivity(), groupList);
        recyclerView.setAdapter(adapter);
    }


    @Override
    public void onClick(View v) {


    }


    @Override
    public boolean onMenuItemClick(MenuItem item) {
        return false;
    }
    void intdata(){
        User_idea user=new User_idea();
        user.setUser_nick("14计科一班");
        user.setPhone("18094152314");
        data.add(user);
        User_idea user1=new User_idea();
        user1.setUser_nick("创业园");
        user1.setPhone("18094125314");
        data.add(user1);
        User_idea user2=new User_idea();
        user2.setUser_nick("102工作室");
        user2.setPhone("18094125314");
        data.add(user2);
        User_idea user3=new User_idea();
        user3.setUser_nick("上贤软件公司");
        user3.setPhone("18094146584");
        data.add(user3);
        User_idea user4=new User_idea();
        user4.setUser_nick("文娱部");
        user4.setPhone("18094123455");
        data.add(user4);


    }
}
